<template>
	<view>
		<!-- banner -->
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">企业助手</view>
			</view>
			<image :src="topimg" mode=""></image>
		</view>
		<!-- 内容 -->
		<view class="mainpadding" style="position: relative;top: 0rpx;">
			<view class="mainpadding radius ffffff">
				<view class="flexbetween">
					<view class="flexleft">
						<view class="line margin_right2"></view>
						<view class="nosmalltext">维瀚法律</view>
					</view>
					<view class="flexright">
						<view class="huisetext1">欢迎使用，有任何问题请进入帮助</view>
						<view class="xgg"></view>
					</view>
				</view>
				<view class="margin_top" @click="yizygy(item)" v-for="item in list.data" :key="item.id">
					<image :src="item.image_text" class="radius" style="width: 100%;height: 180rpx;" mode=""></image>
				</view>
				<!-- <view class="flex_wrap flextops">
					<view class="flexcenter ershiw margin_top" >
						<view class="">
							<view class="jsicon">
								<image :src="item.image_text" mode=""></image>
							</view>
							<view class="nostrongtext margin_top1 textcenter">{{item.name}}</view>
						</view>
					</view>
				</view> -->
			</view>
		</view>
		<view class="wodebgc"></view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				topimg: "",
				page: 1,
				limit: 12,
				list: {
					data: [],
				},
			}
		},
		onLoad() {
			this.getbanner()
			this.init()
		},
		methods: {
			yizygy(item) {
				uni.navigateToMiniProgram({
					// appid  写你要跳转的小程序的 appid
					appId: item.wechat_appid,
					// 路径写  src下的路径,假如你跳转的是pages下的页面,就可以写pages/index
					path: item.wechat_path,
					extraData: {
						// 'type': 'out'
					},
					// 这个不写的话会显示开发环境,不能正常跳转,写上就能正常跳转了
					envVersion: 'release',
					success(res) {
						// 打开成功
						console.log("跳转成功");
						// uni.showToast({
						// 	title: '跳转成功'
						// })
					},
					fail(err) {
						// 打开失败/取消
						console.log("跳转不成功");
						// uni.showToast({
						// 	title: '跳转不成功'
						// })
					}
				})
			},
			init(isPage, page) {
				let _this = this;
				httpRequest.request("/api/index/fljsIndex", 'GET', {
					page: page || 1,
					limit: 100,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							_this.list = resList
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			getbanner() {
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 13,
					is_more: 2
				}, false, false, true).then(res => {
					this.topimg = res.data.image_text
				})
			},
			// 跳转分类计算器
			// yizygy(i) {
			// 	uni.navigateTo({
			// 		url: '/pages/index/jisuanqi?id=' + i
			// 	})
			// }
		}
	}
</script>

<style lang="scss" scoped>
	.wodebgc{
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 400rpx;
		background-image: url("../../static/image/system/bg.png");
		background-size: 100% 100%;
		z-index: -10;
	}
	.jsicon {
		margin: auto;
		width: 100.2rpx;
		height: 100.2rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.ershiw {
		width: 25%;
	}

	.line {
		width: 8rpx;
		height: 28rpx;
		background-color: #00204C;
	}

	page {
		background: #F5F5F5;
	}

	.wqeizhi {
		position: absolute;
		bottom: 84rpx;
		left: 36%;
	}
</style>